package com.boboPlanet.user.lock.impl;

import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;

/**
 * @Description: TODO 分布式 mysql锁
 * @Author: mis_wu
 * @Date: 2023/8/23
 * @Company Lock
 **/
@Slf4j
public class DistributedMySqlLock implements Lock {

    private final String lockName;
    private final String uuid;

    public DistributedMySqlLock(String lockName,String uuid){
        this.lockName = lockName;
        this.uuid = uuid;
    }

    @Override
    public void lock() {
        boolean lock = this.tryLock();
    }

    @Override
    public void lockInterruptibly() throws InterruptedException {

    }

    @Override
    public boolean tryLock() {
        log.info("lockName:{}, uuid:{}",lockName,uuid);
        return false;
    }

    @Override
    public boolean tryLock(long time, @NotNull TimeUnit unit) throws InterruptedException {
        return false;
    }

    @Override
    public void unlock() {

    }

    @NotNull
    @Override
    public Condition newCondition() {
        return null;
    }
}
